$OpenBSD: patch-libdleyna_core_main-loop_c,v 1.1.1.1 2015/04/17 18:39:00 ajacoutot Exp $

From 52d2ccdaac182b2fa2b36dfb21e4a7a41fac4c8d Mon Sep 17 00:00:00 2001
From: Cornel Spinu <cornel.spinu@windriver.com>
Date: Thu, 3 Jul 2014 16:28:22 +0300
Subject: [PATCH] Gracefully exit in case of dbus session crash

--- libdleyna/core/main-loop.c.orig	Sat Dec  6 12:15:53 2014
+++ libdleyna/core/main-loop.c	Fri Apr 17 15:21:06 2015
@@ -57,8 +57,11 @@ static gboolean prv_context_quit_cb(gpointer user_data
 {
 	DLEYNA_LOG_DEBUG("Quitting");
 
-	g_context.connector->disconnect();
-	g_context.control_point->stop_service();
+	if (g_context.connection != NULL)
+	{
+		g_context.connector->disconnect();
+		g_context.control_point->stop_service();
+	}
 
 	g_timeout_add_seconds(1, prv_context_mainloop_quit_cb, NULL);
 
